<!--
 $ @Author: liujiajun 45444154+wo1261931780@users.noreply.github.com
 $ @Date: 2022-06-27 20:35:41
 $ @LastEditors: liujiajun 45444154+wo1261931780@users.noreply.github.com
 $ @LastEditTime: 2022-06-27 20:35:46
 $ @FilePath: \st-ssm.github.io\src\main\java\com\stssm\github\io\javaweb\aaa012JDBC2022年6月27日\aaa048定时器案例.html
 $ @Description: 1111
 $ @
 $ @Copyright (c) 2022 by liujiajun 45444154+wo1261931780@users.noreply.github.com, All Rights Reserved.
 -->
<!DOCTYPE html>
<html lang = "en">
<head>
	<meta charset = "UTF-8"/>
	<meta content = "IE=edge" http-equiv = "X-UA-Compatible"/>
	<meta content = "width=device-width, initial-scale=1.0" name = "viewport"/>
	<title>Document</title>
</head>
<body>
<div>我是定时器案例</div>
<hr/>
<input
		id = "demo1"
		name = "img"
		onclick = "appear()"
		type = "button"
		value = "开灯"
/>
<img
		alt = "测试"
		id = "ceshi"
		src = "../aaa012JAVAWEB2022年6月27日/img/img1.jpg"
		width = "300px"
/>
<input
		id = "demo2"
		name = "img"
		onclick = "appear2()"
		type = "button"
		value = "关灯"
/>
<script>
	var demo = 1;
	setTimeout(() => {
		console.log("我是循环弹出框" + demo);
	}, 1000);
	
	function appear() {
		console.log("我是开灯");
		document.getElementById("ceshi").src =
				"../aaa012JDBC2022年6月27日/img/img1.jpg";
	}
	
	function appear2() {
		console.log("我是关灯");
		document.getElementById("ceshi").src =
				"../aaa012JDBC2022年6月27日/img/img2.jpg";
	}
	
	var x = 0;
	setInterval(() => {
		if (x % 2 == 0) {
			appear();
		} else {
			appear2();
		}
		x++;
	}, 1000);
</script>
</body>
</html>
